Repository navigation
[core] Filter centroid vector shards with colocated Bitmap indexes - #1493
Merged
Merged
Conversation
JingsongLi
force-pushed
the
codex/centroid-shard-bitmaps
branch
from
November 22, 2026 07:14
94409d0 to
1051fbe
Compare
JingsongLi
marked this pull request as ready for review
November 22, 2026 07:19
JingsongLi
force-pushed
the
codex/centroid-shard-bitmaps
branch
from
November 22, 2026 08:04
1051fbe to
a59091a
Compare
JingsongLi
force-pushed
the
codex/centroid-shard-bitmaps
branch
from
November 22, 2026 08:12
a59091a to
ebd8e9d
Compare
leaves12138
approved these changes
Nov 22, 2026
leaves12138
left a comment
There was a problem hiding this comment.
Reviewed the full diff at head ebd8e9d against main (31 files, +2352/-231; branch is 0 behind main, #1491 and #1494 are merged), cross-checked against the Java CentroidBitmapIndex (directory layout, section headers, schema-ID prefix) and CentroidIndexMeta version 2 / matchesIndexFields semantics from apache/paimon#11306 and apache/paimon#11329. Part of #1490.
Core / generic semantics touched (flagging per review policy):
- Generic query path (
de_vector_read.rs): bound Bitmap generations split vector entries into bitmap and regular partitions. Bitmap entries use the pre-scalar-filter searches, drop the post-filter predicate (the bound predicate is exact), skip deleted-row limit inflation (deletions are prefiltered exactly viaBitmapWork.deleted), and exclude their ranges from scalar prefiltering and raw fallback (covered = scalar_prefilter_ranges intersect bitmap_ranges). Regular entries keep the previous scalar-prefilter / post-filter behavior unchanged. - Distributed task contract: new kind
vector-index-centroid-bitmapwithserde(default)BitmapWorkpayload and worker-side validation that kind and payload agree; old workers reject the unknown kind instead of ignoring the predicate. - Scan plan format:
VectorScanPlangainsscalar_prefilter_ranges(skip-if-empty, serde default, merged on deserialize); Python__reduce__now roundtrips the plan as JSON so the coverage metadata survives pickling. The explicit(splits, snapshot)constructor intentionally loses it, which the tests document. - Build pipeline:
extra_fieldsJSON option (centroid sharding required, vindex types only, BTree-compatible field validation, vector column itself rejected); streamedBitmapSpilloffset/key files preserve sparse source labels (zero-offset holes for vector-null rows and all-null batches); per-shard sections are written through the newwrite_sorted_bitmap_sectionwith 1MB flushes and section-relative offsets; version 2 descriptors carryextra_field_idsand a build-schema-ID directory prefix. RequiresTHROW_ERRORorDROP_PARTITION_INDEXfor the column-update action at build time. - Commit semantics: a colocated Bitmap belongs to the vector index identity (
index_identity_extra_fieldsreturns None for version-2 files), so rebuild replaces the whole group and drop-by-vector-column removes Bitmap files; overlap validation uses the same identity. Under IGNORE, updates touching index or extra fields of a retained overlapping Bitmap generation are rejected, and a partial router-only delete does not bypass the check. - Generation validation: version 2 requires non-empty, duplicate-free extra field IDs excluding the index field; one Bitmap per populated shard with matching row counts; consistent build schema ID across sections; directory parsing mirrors the Java bounds checks (section lengths sum to file size, no trailing bytes).
- Bitmap writer refactor: the existing single-file writer now shares
BitmapSectionWriter; block order (nulls, non-nulls, postings, dictionary, index, footer) and footer encoding are unchanged for the non-centroid path.
What I verified:
- Predicate binding is exact-or-fallback: only
=,IN,IS NULL,IS NOT NULL,AND,ORover allowed build fields bind; any unsupported leaf falls back to ordinary scalar filtering for the whole generation. Non-finite float literals and lossy decimal/timestamp normalization decline binding; signed-zero and cross-type float/double behavior matches the Java dictionary representation (tests pin -0.0 vs 0.0, decimal rescale, sub-milli timestamp). - Schema evolution: binding checks field ID and type (ignoring nullability) against the build schema; renames keep working, type changes fall back without opening Bitmap files; the REST fallback accepts only the exact requested schema ID on the default branch (both older and newer loaded handles are covered by tests).
- Per-shard evaluation intersects the Bitmap result with validated deletion ranges and per-query include IDs, validates row-ID bounds against the shared source range, and skips the ANN file entirely on empty matches (test deletes the ANN payload of a nonmatching shard). Joint probing is disabled for Bitmap work; widening still applies so exact prefiltering can visit more shards to fill Top-K.
- Java compatibility: a real Java-generated two-section sparse Bitmap file (
CentroidBitmapIndex.Writer+CentroidIndexMeta.scalarIndex) is read correctly, including OR across columns and relative labels 2/4 at source range [10, 14]. - Test coverage: scheduled and buffered reads agree; group replacement and drop; IGNORE update rejection incl. partial-drop bypass attempt; streamed section offsets across 1MB flushes; sparse spill labels with tiny sort/dictionary budgets; SQL
CALL sys.create_global_indexwithextra_fieldsplus cross-column OR throughvector_search; pickle roundtrip preserving scalar coverage; plan reuse with a different filter.
No findings. CI is fully green at this head (15/15 checks).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Part of #1490. Add Java-compatible scalar Bitmap filters to centroid shards, including cross-column OR. Aligns with apache/paimon#11306 and apache/paimon#11329.
Depends on #1491. Review the Bitmap-only diff.
Brief change log
extra_fieldson centroid builds. Write a Bitmap file per populated vector shard using row labels relative to the shared source range. The directory records the build schema and section lengths.=,IN, null checks,AND, andORagainst compatible build fields. Intersect the result with row and deletion filters before ANN, and skip the ANN file for empty matches.Tests
Exercises scheduled exact prefiltering with an ANN file absent from a nonmatching shard, group replacement and drop, and a Java-generated two-section sparse Bitmap file.
API and Format
Uses Java's version 2 centroid metadata. Adds the optional
extra_fieldsargument to DataFusion's create-index procedure and accepts the same JSON in Rust build options.Documentation
Adds a centroid build example with two Bitmap columns and describes exact predicate support and fallback.